package com.rachel.studyapp.mvp.present;

import android.content.Context;

import com.rachel.studyapp.json.homejson.HomeRoot;
import com.rachel.studyapp.mvp.ContractUtils;
import com.rachel.studyapp.mvp.base.BasePresent;
import com.rachel.studyapp.mvp.model.HomeModel;

/**
 * Created by zhengshaorui on 2017/8/22.
 */

public class HomePresent extends BasePresent<ContractUtils.IHomeView>
        implements ContractUtils.IHomePresent {
    private HomeModel mModel;
    private ContractUtils.IHomeView mView;


    public HomePresent(Context context,ContractUtils.IHomeView view) {
        this.mView = view;
        mModel = new HomeModel(context,this);
    }

    @Override
    public void onCreatePresent() {
        mModel.handleJsonData();
    }

    @Override
    public void getJsonData(HomeRoot root) {
        mView.getJsonData(root);
    }

    @Override
    public void onFailure(Object errorObj) {
        mView.onFailure(errorObj);
    }
}
